// 主界面
;
define(function(require, exports, module) {
	'use strict';
	var base = require("base");
	var databind = require("databind");
	var enterpriseType;
	var isAlready;
	var tools = require("tools");
	//	var _css = require("./login.css");

	var init = function() {
		enterpriseType = base.getUrlParam("enterpriseType");
		isAlready = base.getUrlParam("isAlready");
		if (enterpriseType == 0) {
			if (isAlready == "true") {
				$(".title").html("直客敞口额度(单位:万元)");
			} else {
				$(".title").html("直客综合授信额度(单位:万元)");
			}
		} else if (enterpriseType == 1) {
			if (isAlready == "true") {
				$(".title").html("分销商敞口额度(单位:万元)");
			} else {
				$(".title").html("分销商综合授信额度报表(单位:万元)");
			}
		}
		initEvent();
	};
	var initEvent = function() {
		inquireEnterpriseFinanceSummaryPageList(enterpriseType);
	};


	var inquireEnterpriseFinanceSummaryPageList = function(enterpriseType) {
		base.fnAjax({
			action: "inquireEnterpriseFinanceSummaryPageList.json",
			async: true,
			nocode: true,
			oData: {
				enterpriseType: enterpriseType,
				pageSize: 1000
			}, //传递参数
			fnSuccess: function(data) {
				if(data.status == 200) {
					juicer.register("formatCurrency", tools.formatCurrency);
					var tpl = $(".dataTpl").html();
					if (isAlready == "true") {
						tpl = $(".dataTpl1").html();
					}
					var html = juicer(tpl, data);
					$(".dataBody").html(html);
				} else { 
					layer.msg(data.message);
				}
			}
		});
	};

	return {
		init: init
	};
});